<?php 
class Lib_Application_Resource_Navigation extends Zend_Application_Resource_ResourceAbstract
{
	protected $_config;
	
	public function init(){
	    $this->getBootstrap()->bootstrap("layout");
        $layout = $this->getBootstrap()->getResource('layout');    

	    
        $view = $layout->getView();
        $options =  $this->getOptions();       
        
        $filePath = $options['file']['path'];
//        $fileSection = $options['file']['section'];
        
        switch ($options['file']['type']){
            case "xml":
                 $config = new Zend_Config_Xml($filePath);
            break;
               
            case "ini":
                $config = new Zend_Config_Ini($filePath);
            break;
            
            default:
                throw new Zend_Config_Exception('Unknown format'. $options['file']['type'] .' of config while loading navigation');
            break;
        };
        
        $navigation = new Zend_Navigation($config);
        $view->navigation($navigation);
        Zend_Registry::set('navigation', $navigation);
	}
}